<!DOCTYPE html>
<html>
	<head>
<title>订单查询</title>
	<!-- jQuery 主文件 -->
	<script type="text/javascript" src="../js/jquery.min.js" ></script>
	<!-- easyui 主文件 -->
	<script type="text/javascript" src="../js/jquery.easyui.min.js" ></script>
	<!-- 国际化文件 -->
	<script type="text/javascript" src="../js/locale/easyui-lang-zh_CN.js" ></script>
	<!-- easyui 主样式文件 -->
	<link rel="stylesheet" href="../js/themes/black/easyui.css" />
	<link rel="stylesheet" href="../js/themes/icon.css" />	
	<script type="text/javascript">
	$(function(){ 
		$("#btnSearch").click(function () {  
	        var pars = {minprice:$('#minprice').val(),maxprice:$('#maxprice').val()};  
	        //有参数时执行此方法  
	        initTable(pars);  
	    });  
	    //无参数时执行此方法  
	    initTable("");  
	})
	function initTable(pars){
		$("#tb").datagrid({
		   	url:"purchaselist1",
		   	method:"get",
		   	queryParams:pars,
			columns:[[  
	            {field:'Id',title:'全选',width:100,checkbox:true},      
		        {field:'purchaseId',title:'订单号',width:100,align:'right'},    
		        {field:'productId',title:'产品编号',width:100,align:'right'},    
		        {field:'productName',title:'产品名称',width:100,align:'right'}, 
		        {field:'productType',title:'产品类型',width:100,align:'right'},
				{field:'productNumber',title:'产品数量',width:100,align:'right'},
				{field:'productPieces',title:'单位 ',width:100,align:'right'}, 
				{field:'productPrices',title:'单价(元)',width:100,align:'right'}, 
				{field:'purchaser',title:'采购员',width:100,align:'right'}, 
				{field:'purchasedate',title:'采购时间',width:100,align:'right'},
				{field:'dealine',title:'到货时间 ',width:100,align:'right'},
				{field:'saveDate',title:'下单时间',width:100,align:'right'},
				{field:'purchaseLister',title:'审批人',width:100,align:'right'},
				{field:'remark',title:'备注 ',width:100,align:'right'},
				{field:'supplierId',title:'供货商编号 ',width:100,align:'right'},
		    ]],
		    fit:true,
		    toolbar: '#price',
			loadMsg:"数据加载中...，请等待!",
			pageSize:10,
			singleSelect:true,
			fitColumns:true,
			pagination:true,
			rownumbers:true,
			onClickRow:function(rowIndex, rowData){
//								alert(rowIndex);
//				alert(rowData.productName);
			}
	});
	}	
	function print(){
		var row = $('#tb').datagrid('getSelected');	
		if (row&&row.remark=="未下单"){
			if(confirm("确定下单？")){
			location="pdf?purchaseId="+row.purchaseId;
			$('#tb').datagrid('reload');
			}
		}else{
			alert("该产品已下单");
		}
		
	}	                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        	
	</script>
	<style type="text/css">
		#fm{
			margin:0;
			padding:10px 30px;
		}
		.ftitle{
			font-size:14px;
			font-weight:bold;
			color:#666;
			padding:5px 0;
			margin-bottom:10px;
			border-bottom:1px solid #ccc;
		}
		.fitem{
			margin-bottom:5px;
		}
		.fitem label{
			display:inline-block;
			width:80px;
		}
	</style>
	</head>
	<body>
	<table id="tb" title="订单价格表"></table>
		<div id="price" >
			&nbsp;&nbsp;&nbsp;<span style="color:white;font-size:13px;font-weight:bold">价格区间 (元)</span><input  id="minprice" name="minprice" type= "text" placeholder="输入最低价" style="margin-left:20px"></input>  ———— 
			<input  id="maxprice" name="maxprice" placeholder="输入最高价"  type= "text" ></input> 
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<a id="btnSearch" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-query'">查询</a>
			<a id="btn" href="javascript:print()" class="easyui-linkbutton" data-options="iconCls:'icon-print'">打印</a>
		</div>
		

	</body>
</html>
